-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: change the AI command line argument to optional #617
feat: change the AI command line argument to optional #617
Conversation
pkg/core/handler/search/search.go
Outdated
@@ -69,7 +67,12 @@ func SearchForResource(searchMgr *search.SearchManager, aiMgr *ai.AIManager, sea | |||
query := searchQuery | |||
|
|||
if searchPattern == storage.NLPatternType { | |||
//logger.Info(searchQuery) | |||
// logger.Info(searchQuery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless comments can be removed
pkg/core/manager/ai/manager.go
Outdated
@@ -25,7 +25,10 @@ type AIManager struct { | |||
|
|||
// NewAIManager returns a new AIManager object | |||
func NewAIManager(c registry.ExtraConfig) (*AIManager, error) { | |||
aiClient := ai.NewClient(c.Backend) | |||
if c.AIAuthToken == "" { | |||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the token is empty, an error should be returned, otherwise the npe error is prone to occur
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Karpor starts, it creates a new AIManager. If return the error, the startup will fail. Now I am re-evaluating whether it is null when calling the aimanager function. Is there any other way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be up to the caller to decide which errors to ignore. The underlying method should ensure that the returned entity is not empty when there are no errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
dbf281e
into
KusionStack:support-natural-language
What type of PR is this?
/kind feature
What this PR does / why we need it:
change the AI command line argument to optional
Which issue(s) this PR fixes:
Fixes #551